
const externalData = [
  {
    name: '数据集1',
    points: [
      [10.0, 8.04],
      [8.07, 6.95],
      [13.0, 7.58],
      [9.05, 8.81],
      [11.0, 8.33],
      [14.0, 7.66],
      [13.4, 6.81],
      [10.0, 6.33],
      [14.0, 8.96],
      [12.5, 6.82]
    ]
  },
  {
    name: '数据集2',
    points: [
      [12.5, 7.82],
      [9.15, 7.2],
      [11.5, 7.2],
      [3.03, 4.23],
      [12.2, 7.83],
      [2.02, 4.47],
      [1.05, 3.33],
      [4.05, 4.96],
      [6.03, 7.24],
      [12.0, 6.26]
    ]
  }
];

export default function getData() {
  return {
    toolbox: {
      feature: {
        saveAsImage: {
          type: 'png',
          name: 'scatter_chart',
          title: 'Download Image'
        }
      }
    },
    legend: {
      data: externalData.map(dataset => dataset.name) // 动态生成图例数据
    },
    xAxis: {
      name: 'X轴', // 增加X轴名称
      type: 'value'
    },
    yAxis: {
      name: 'Y轴', // 增加Y轴名称
      type: 'value'
    },
    series: externalData.map(dataset => ({
      name: dataset.name,
      symbolSize: 20,
      data: dataset.points,
      type: 'scatter'
    }))
  };
}
